package com.sq.partner.manager.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sq.partner.manager.dao.FacadeAppApplicantDao;
import com.sq.partner.manager.mybatis.model.FacadeAppApplicant;
import com.sq.partner.manager.service.FacadeAppApplicantService;
import com.sq.partner.manager.util.DateUtil;

/**
 * 投保人service实现类
 * 
 * SQ
 *
 */
@Service
public class FacadeAppApplicantServiceImpl implements
        FacadeAppApplicantService {

    @Resource
    FacadeAppApplicantDao facadeAppApplicantDao;
    
    /**
     * 添加投保人
     * 
     * @param facadeAppApplicant
     * @throws Exception
     */
    @Override
    public FacadeAppApplicant saveFacadeAppApplicant(
            FacadeAppApplicant facadeAppApplicant) throws Exception {
        //取得新的投保人编码
        String newClientNo = facadeAppApplicantDao.queryNewTbrClientNo();
        facadeAppApplicant.setClientNo(newClientNo);
        facadeAppApplicant.setUpdateTime(DateUtil.getNowTimestamp());
        facadeAppApplicant.setCreatTime(DateUtil.getNowTimestamp());
        //添加投保人
        facadeAppApplicantDao.insertFacadeAppApplicant(facadeAppApplicant);
        return facadeAppApplicant;
    }

}
